package cn.hiapi.user.query;

import cn.hiapi.basic.jpa.pageable.QueryWrapper;
import cn.hiapi.basic.jpa.query.BasicQuery;
import lombok.Getter;
import lombok.Setter;

/**
 * @author AdinZ
 * @date 2023/1/2 15:23
 */
@Setter
@Getter
public class ActivityCardOrderQuery extends BasicQuery {
    private Integer status;


    private long buyerId;

    @Override
    public QueryWrapper getQueryWrapper() {
        QueryWrapper wrapper = super.getBasicQueryWrapper().eq("buyerId",buyerId);
        if (status != null && status == 2) {
            wrapper.eq("status", 0).le("useEnd", System.currentTimeMillis());
        } else wrapper.eq("status", status);
        return wrapper;
    }
}
